/*
 * Copyright (c) 2024, NVIDIA CORPORATION.  All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * NOTE: This code is auto-generated by generate_nvml_stubs.py
 * DO NOT EDIT MANUALLY
 */


// clang-format off
#pragma once

#include <functional>
#include <optional>
#include <string>
#include <tuple>
#include <vector>

#include <unordered_map>

#include "NvmlFuncReturn.h"

#include <yaml-cpp/node/node.h>

// The following snippet is generated from nvml_return_deserializer_header_writer
class NvmlReturnDeserializer
{
private:
    std::unordered_map<std::string, std::function<std::optional<NvmlFuncReturn>(const YAML::Node &)>> m_deviceHandlers;
    std::unordered_map<std::string, std::tuple<std::function<std::optional<InjectionArgument>(const YAML::Node &)>, std::function<std::optional<NvmlFuncReturn>(const YAML::Node &)>>> m_deviceExtraKeyHandlers;

    std::unordered_map<std::string, std::tuple<std::function<std::optional<InjectionArgument>(const YAML::Node &)>, std::function<std::optional<InjectionArgument>(const YAML::Node &)>, std::function<std::optional<NvmlFuncReturn>(const YAML::Node &)>>> m_deviceThreeKeysHandlers;

    std::unordered_map<std::string, std::function<std::optional<NvmlFuncReturn>(const YAML::Node &)>> m_gpuInstanceHandlers;
    std::unordered_map<std::string, std::function<std::optional<NvmlFuncReturn>(const YAML::Node &)>> m_computeInstanceHandlers;
    std::unordered_map<std::string, std::tuple<std::function<std::optional<InjectionArgument>(const YAML::Node &)>, std::function<std::optional<NvmlFuncReturn>(const YAML::Node &)>>> m_gpuInstanceExtraKeyHandlers;

    std::unordered_map<std::string, std::tuple<std::function<std::optional<InjectionArgument>(const YAML::Node &)>, std::function<std::optional<InjectionArgument>(const YAML::Node &)>, std::function<std::optional<NvmlFuncReturn>(const YAML::Node &)>>> m_gpuInstanceThreeKeysHandlers;

    std::unordered_map<std::string, std::function<std::optional<NvmlFuncReturn>(const YAML::Node &)>> m_vgpuTypeHandlers;
    std::unordered_map<std::string, std::tuple<std::function<std::optional<InjectionArgument>(const YAML::Node &)>, std::function<std::optional<NvmlFuncReturn>(const YAML::Node &)>>> m_vgpuTypeExtraKeyHandlers;

    std::unordered_map<std::string, std::function<std::optional<NvmlFuncReturn>(const YAML::Node &)>> m_vgpuInstanceHandlers;
    std::unordered_map<std::string, std::function<std::optional<NvmlFuncReturn>(const YAML::Node &)>> m_generalHandlers;
public:
    NvmlReturnDeserializer();
    std::optional<NvmlFuncReturn> DeviceHandle(const std::string &key, const YAML::Node &node);
    std::optional<NvmlFuncReturn> GpuInstanceHandle(const std::string &key, const YAML::Node &node);
    std::optional<NvmlFuncReturn> ComputeInstanceHandle(const std::string &key, const YAML::Node &node);
    std::optional<NvmlFuncReturn> VgpuTypeHandle(const std::string &key, const YAML::Node &node);
    std::optional<NvmlFuncReturn> VgpuInstanceHandle(const std::string &key, const YAML::Node &node);
    std::optional<NvmlFuncReturn> GeneralHandle(const std::string &key, const YAML::Node &node);
    std::optional<std::vector<std::tuple<InjectionArgument, NvmlFuncReturn>>> DeviceExtraKeyHandle(const std::string &key, const YAML::Node &node);
    std::optional<std::vector<std::tuple<InjectionArgument, InjectionArgument, NvmlFuncReturn>>> DeviceThreeKeysHandle(const std::string &key, const YAML::Node &node);
    std::optional<std::vector<std::tuple<InjectionArgument, NvmlFuncReturn>>> GpuInstanceExtraKeyHandle(const std::string &key, const YAML::Node &node);
    std::optional<std::vector<std::tuple<InjectionArgument, NvmlFuncReturn>>> VgpuTypeExtraKeyHandle(const std::string &key, const YAML::Node &node);
    std::optional<std::vector<std::tuple<InjectionArgument, InjectionArgument, NvmlFuncReturn>>> GpuInstanceThreeKeysHandle(const std::string &key, const YAML::Node &node);
};
